package com.example.demo.spring.beans.factory.config;

import com.example.demo.spring.beans.factory.MyHierarchicalBeanFactory;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.config.BeanExpressionResolver;
import org.springframework.core.convert.ConversionService;

/**
 * 提供配置Factory的方法
 *
 * @author: htc
 * @date: Created in 17:10 2018/11/29.
 */
public interface MyConfigurableBeanFactory extends MyHierarchicalBeanFactory, MySingletonBeanRegistry {
    /**
     * 标准单例范围的范围标识符：“singleton”。
     */
    String SCOPE_SINGLETON = "singleton";

    /**
     * 标准原型范围的范围标识符：“prototype”。
     */
    String SCOPE_PROTOTYPE = "prototype";

    /**
     * 设置工厂的父类
     * Set the parent of this bean factory.
     * <p>Note that the parent cannot be changed: It should only be set outside
     * a constructor if it isn't available at the time of factory instantiation.
     * @param parentBeanFactory the parent BeanFactory
     * @param parentBeanFactory
     * @throws IllegalStateException
     */
    void setParentBeanFactory(BeanFactory parentBeanFactory) throws IllegalStateException;

    /**
     * 返回工厂类的类加载器
     * Return this factory's class loader for loading bean classes.
     * @param beanClassLoader
     */
    void setBeanClassLoader(ClassLoader beanClassLoader);

    /**
     * Return the temporary ClassLoader to use for type matching purposes,
     * @param tempClassLoader
     */
    void setTempClassLoader(ClassLoader tempClassLoader);

    /**
     * 是否缓存bean的元数据，如bean的定义信息以及class
     * @param cacheBeanMetadata
     */
    void setCacheBeanMetadata(boolean cacheBeanMetadata);

    /**
     * 返回bean定义值中表达式的解析策略
     * @return
     */
    BeanExpressionResolver getBeanExpressionResolver();

    /**
     *  Specify a Spring 3.0 ConversionService to use for converting
     * property values, as an alternative to JavaBeans PropertyEditors.
     * @param conversionService
     */
    void setConversionService(ConversionService conversionService);

    /**
     * Return the associated ConversionService, if any.
     * @since 3.0
     */
    ConversionService getConversionService();
}
